package edu.nakan.convertchartonumber;

import java.util.Scanner;

/**
 * @author PHUNG Nam Can - NakanPhung
 * @mail cank56hua@gmail.com
 * @date Jul 23, 2013 11:38:45 AM
 * @project HomeWorkDay4Problem3
 * @file Demo.java
 */

public class Demo {

	private static Scanner input;

	public static void main(String[] args) {
		String str = "";
		int sum = 0;

		input = new Scanner(System.in);
		System.out.println("Please input the String number !");

		str = input.nextLine();

		// To split the input String with " " (only one space) and put it to
		// String array
		String[] data = str.split(" ");

		for (int i = 0; i < data.length; i++) {
			try {
				int number = Integer.parseInt(data[i]);
				sum = sum + number;
			} catch (Exception NumberFormatException) {
				System.out
						.println("The String input with only one space between 2 text and the number. ");
			}
			

		}

		System.out.println("Sum is : " + sum);

	}
}
